package com.xlobo.api.inventory.testcase;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.xlobo.api.inventory.parameter.InventoryAddRequestBean;
import com.xlobo.api.inventory.service.InventoryAddRequestCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.TestCase;
import com.ymt.utils.annotation.TestSuite;
import com.ymt.utils.tag.P1;
import com.ymt.utils.tag.P3;
import com.ymttest.utils.TestDataManager;

/**
 * 增加库存接口 FreeMaker Template自动生成代码
 */
@TestSuite
public class Ts_InventoryAddRequest {
	private static InventoryAddRequestBean inventoryAddBean;
	private static InventoryAddRequestCall inventoryAddCall;

	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("增加库存接口");
	}

	@Before
	public void caseUp() {
		inventoryAddBean = new InventoryAddRequestBean();
		inventoryAddCall = new InventoryAddRequestCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(inventoryAddCall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_InventoryAddRequest_001() {
		Logger.start(true,"增加库存成功");
		try {
			String BusinessId = TestDataManager.getRandomUUID().toString();
			inventoryAddBean.setBusinessId(BusinessId);
			inventoryAddBean.setBusinessType(104);
			inventoryAddBean.setBatchNo("XC_Test_2");
			inventoryAddBean.setAddCount(100);
			inventoryAddCall.setData(inventoryAddBean);
			inventoryAddCall.callService();
			Logger.comment("发送appcall报文:" + inventoryAddCall.getEntityString());
			Logger.comment("返回appcall报文：" + inventoryAddCall.getReturnData());
			Logger.verifyEquals("true", inventoryAddCall.getSuccess(), "验证Code");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P3.class)
	@TestCase
	public void Tc_InventoryAddRequest_002() {
		Logger.start(true,"不输入必填项BusinessId失败");
		try {
			// TODO 补全case代码
			org.junit.Assert.fail();
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}